home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap11 / howto05 / cciccinf.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-24  |  42.2 KB  |  1,135 lines

  1. unit Cciccinf;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, Outline, CCWSock;
  8.  
  9. type
  10.   TCCICInfoDlg = class(TForm)
  11.     Panel1: TPanel;
  12.     BitBtn1: TBitBtn;
  13.     BitBtn2: TBitBtn;
  14.     Panel4: TPanel;
  15.     ListBox2: TListBox;
  16.     Panel2: TPanel;
  17.     Edit1: TEdit;
  18.     Panel3: TPanel;
  19.     Edit2: TEdit;
  20.     Panel5: TPanel;
  21.     Edit3: TEdit;
  22.     Panel8: TPanel;
  23.     Edit4: TEdit;
  24.     Panel9: TPanel;
  25.     Edit5: TEdit;
  26.     Panel6: TPanel;
  27.     Label1: TLabel;
  28.     Label2: TLabel;
  29.     Button1: TButton;
  30.     Button2: TButton;
  31.     Button3: TButton;
  32.     Button4: TButton;
  33.     ListBox1: TListBox;
  34.     procedure Button1Click(Sender: TObject);
  35.     procedure ListBox2Click(Sender: TObject);
  36.     procedure BitBtn1Click(Sender: TObject);
  37.     procedure BitBtn2Click(Sender: TObject);
  38.     procedure Edit4Exit(Sender: TObject);
  39.     procedure Button2Click(Sender: TObject);
  40.     procedure Button3Click(Sender: TObject);
  41.     procedure Button4Click(Sender: TObject);
  42.     procedure ListBox1DblClick(Sender: TObject);
  43.   private
  44.     { Private declarations }
  45.   public
  46.     { Public declarations }
  47.   end;
  48.  
  49. var
  50.   CCICInfoDlg: TCCICInfoDlg;
  51. const
  52.   LBClickVector : Integer = 0;
  53.   ActiveMailbox : Integer = 0;
  54.  
  55. implementation
  56.  
  57. uses CCICCFrm, CCICCPOP;
  58.  
  59. {$R *.DFM}
  60. procedure TCCICInfoDlg.Button1Click(Sender: TObject);
  61. var TempSocket : TCCSocket; { Used for IP Address info }
  62.     DataBuffer : array[ 0 .. 256 ] of char;
  63. begin
  64.   case Tag of
  65.     1 : begin  { Get IP Address Mode }
  66.           { Create the dummy socket }
  67.           TempSocket := TCCSocket.Create( Self );
  68.           TempSocket.Parent := Self;
  69.           { Use it to get the info }
  70.           with TempSocket do
  71.           begin
  72.             { Move the IP address into the data buffer }
  73.             StrPCopy( DataBuffer , Edit1.Text );
  74.             { Turn it into a real IP address in binary form }
  75.             Socket_IP_Address.Socket_Address.Full_Internet_Address :=
  76.              inet_addr( DataBuffer );
  77.             { If not found then do remote lookup }
  78.             if Socket_IP_Address.Socket_Address.Full_Internet_Address = INADDR_NONE then
  79.             begin
  80.               { Call blocking function on IP name }
  81.               Socket_Host_Entry := gethostbyname( DataBuffer );
  82.               { If still no good then error out and exit }
  83.               if Socket_Host_Entry = nil then
  84.               begin
  85.                 Edit2.Text := 'Could Not Convert Host Name';
  86.                 Edit3.Text := '';
  87.               end
  88.               else
  89.               begin
  90.                 { Otherwise get the address }
  91.                 Socket_IP_Address.Socket_Address :=
  92.                  Socket_Host_Entry^.Host_Address^^;
  93.                 Edit2.Text :=
  94.                  IntToStr( Socket_IP_Address.Socket_Address.Net_Byte ) + '.' +
  95.                  IntToStr( Socket_IP_Address.Socket_Address.Host_Byte ) + '.' +
  96.                  IntToStr( Socket_IP_Address.Socket_Address.Local_Host_Byte ) +
  97.                  '.' + IntToStr(
  98.                  Socket_IP_Address.Socket_Address.Local_Machine_Byte );
  99.                 Edit3.Text :=
  100.                  IntToStr( Socket_IP_Address.Socket_Address.
  101.                             Full_Internet_Address );
  102.               end;
  103.             end;
  104.           end;
  105.           { Free the dummy socket }
  106.           TempSocket.Free;
  107.         end;
  108.     2 : begin { Anonymous login punch }
  109.           Edit3.Text := 'anonymous';
  110.           CurrentRealPWString := CurrentPassWordString;
  111.           case PasswordControlVector of
  112.             1 : Edit4.Text := CurrentPassWordString;
  113.             2 : Edit4.Text := '**********';
  114.           end;
  115.         end;
  116.     5 : begin { Toggle subscribe/unsubscribe status }
  117.           if Edit3.Text = 'Subscribed' then Edit3.Text := 'UnSubscribed' else
  118.            Edit3.Text := 'Subscribed';
  119.         end;
  120.     7 : begin { Set LBClickVector to 1 to allow clicking to move msg }
  121.           LBClickVector := 1;
  122.           ActiveMailBox := ListBox2.ItemIndex;
  123.         end;
  124.   end;
  125. end;
  126.  
  127. procedure TCCICInfoDlg.ListBox2Click(Sender: TObject);
  128. var TheWorkingList  : TList;
  129.     Counter_1       : Integer;
  130.     WorkingMBRecord : PEMailMailboxRecord;
  131.     Finished        : Boolean;
  132. begin
  133.   { Use Tag vector to find out how to interpret a click }
  134.   case Tag of
  135.     2 : begin
  136.           { If nothing in list box then exit }
  137.           if ListBox2.ItemIndex = -1 then exit;
  138.           { Use the data in the Working FTP Site List TList }
  139.           with PConnectionsRecord(
  140.            TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  141.           begin
  142.               Edit1.Text := CProfile;
  143.               Edit2.Text := CIPAddress;
  144.               Edit3.Text := CUserName;
  145.               CurrentRealPWString := CPassword;
  146.               case PasswordControlVector of
  147.                 1 : Edit4.Text := CPassword;
  148.                 2 : Edit4.Text := '**********';
  149.               end;
  150.               Edit5.Text := CStartDir;
  151.           end;
  152.         end;
  153.     4 : begin
  154.           { If nothing in list box then exit }
  155.           if ListBox2.ItemIndex = -1 then exit;
  156.           { Use the data in the Working FTP Site List TList }
  157.           with PConnectionsRecord(
  158.            TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  159.           begin
  160.               Edit1.Text := CProfile;
  161.               Edit2.Text := CIPAddress;
  162.           end;
  163.         end;
  164.     5 : begin
  165.           { If nothing in list box then exit }
  166.           if ListBox2.ItemIndex = -1 then exit;
  167.           { Use the data in the Working FTP Site List TList }
  168.           with PNewsGroupRecord(
  169.            TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  170.           begin
  171.               Edit1.Text := GName;
  172.               Edit2.Text := GRealName;
  173.               if GSubScribed then Edit3.Text := 'Subscribed' else
  174.                Edit3.Text := 'UnSubscribed';
  175.           end;
  176.         end;
  177.     6 : begin
  178.           { If nothing in list box then exit }
  179.           if ListBox2.ItemIndex = -1 then exit;
  180.           { Use the data in the Working POPSMTP Site List TList }
  181.           with PConnectionsRecord(
  182.            TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  183.           begin
  184.               Edit1.Text := CProfile;
  185.               Edit2.Text := CIPAddress;
  186.               Edit3.Text := CUserName;
  187.               CurrentEMRealPWString := CPassword;
  188.               case EMPasswordControlVector of
  189.                 1 : Edit4.Text := CPassword;
  190.                 2 : Edit4.Text := '**********';
  191.               end;
  192.               Edit5.Text := CStartDir;
  193.           end;
  194.         end;
  195.     7 : begin
  196.           case LBClickVector of
  197.            0 : begin
  198.                  { If nothing in list box then exit }
  199.                  if ListBox2.ItemIndex = -1 then exit;
  200.                  ActiveMailBox := ListBox2.ItemIndex;
  201.                  { Use the data in the Working FTP Site List TList }
  202.                  with PEMailMailboxRecord(
  203.                   TheWorkingMBSL.Items[ ListBox2.ItemIndex ] )^ do
  204.                  begin
  205.                    Edit1.Text := MBName;
  206.                    ListBox1.Clear;
  207.                    TheWorkingList := TList( MBLTag );
  208.                    if TheWorkingList.Count > 0 then
  209.                    begin
  210.                      for Counter_1 := 0 to TheWorkingList.Count - 1 do
  211.                      begin
  212.                        ListBox1.Items.Add( PEMailMessageRecord(
  213.                         TheWorkingList.Items[ Counter_1 ] )^.MRMessageSubject );
  214.                      end;
  215.                      Listbox1.ItemIndex := 0;
  216.                    end;
  217.                  end;
  218.                end;
  219.            1 : begin
  220.                  { If nothing in list box then exit }
  221.                  if ListBox2.ItemIndex = -1 then exit;
  222.                  WorkingMBRecord := PEMailMailboxRecord(
  223.                   TheWorkingMBSL.Items[ ActiveMailbox ] );
  224.                  TheWorkingList := TList( WorkingMBRecord^.MBLTag );
  225.                  for Counter_1 := 0 to ListBox1.Items.Count - 1 do
  226.                  begin
  227.                    if ListBox1.Selected[ Counter_1 ] then
  228.                    begin
  229.                      ThePOP3SMTPComponent.TransferMessage(
  230.                       PEMailMailboxRecord( TheWorkingMBSL.Items[ ActiveMailBox ] ) ,
  231.                       PEMailMailboxRecord( TheWorkingMBSL.Items[ ListBox2.ItemIndex ] ) ,
  232.                       Counter_1 );
  233.                      PEMailMessageRecord( TheWorkingList.Items[ Counter_1 ] )^.
  234.                       MRMailBoxName := 'Delete Me!';
  235.                    end;
  236.                  end;
  237.                  Counter_1 := 0;
  238.                  Finished := false;
  239.                  while not Finished do
  240.                  begin
  241.                    if Counter_1 < TheWorkingList.Count then
  242.                    begin
  243.                      if PEMailMessageRecord( TheWorkingList.Items[ Counter_1 ] )^.
  244.                       MRMailBoxName = 'Delete Me!' then
  245.                      begin
  246.                        TheWorkingList.Delete( Counter_1 );
  247.                      end
  248.                      else
  249.                      begin
  250.                        Inc( Counter_1 );
  251.                        if Counter_1 >= TheWorkingList.Count then Finished := true;
  252.                      end;
  253.                    end
  254.                    else finished := true;
  255.                  end;
  256.                  WorkingMBRecord^.MBLTag := Longint( TheWorkingList );
  257.                  ListBox2.ItemIndex := ActiveMailbox;
  258.                  LBClickVector := 0;
  259.                  ListBox1.Clear;
  260.                  for Counter_1 := 0 to TheWorkingList.Count - 1 do
  261.                  begin
  262.                    ListBox1.Items.Add( PEMailMessageRecord(
  263.                     TheWorkingList.Items[ Counter_1 ] )^.MRMessageSubject );
  264.                  end;
  265.                  Listbox1.ItemIndex := 0;
  266.               end;
  267.           end;
  268.         end;
  269.     8 : begin
  270.           { If nothing in list box then exit }
  271.           if ListBox2.ItemIndex = -1 then exit;
  272.           { Use the data in the Working FTP Site List TList }
  273.           with PConnectionsRecord(
  274.            TheWorkingCPSL.Items[ ListBox2.ItemIndex ] )^ do
  275.           begin
  276.               Edit1.Text := CProfile;
  277.               Edit2.Text := CIPAddress;
  278.           end;
  279.         end;
  280.   end;
  281. end;
  282.  
  283. { This procedure saves the newly modified list of stuff to its base }
  284. procedure TCCICInfoDlg.BitBtn1Click(Sender: TObject);
  285. var Counter_1  : Integer;            { Loop counter        }
  286.     ThePointer : PConnectionsRecord; { Generic TCR Pointer }
  287.     TheNGRecord : PNewsGroupRecord;
  288.     TheMBRecord : PEMailMailboxRecord;
  289. begin
  290.   { Use the tag vector to find out what to do }
  291.   case Tag of
  292.     2 : begin { Do FTP Site List }
  293.           { dispose the old FTP site list's pointers }
  294.           for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  295.           begin
  296.             Dispose( PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] ));
  297.           end;
  298.           { Clear the lists }
  299.           TheFTPSiteList.Clear;
  300.           CCInetCCForm.ComboBox1.Clear;
  301.           { Add the new info }
  302.           for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
  303.           begin
  304.             { Create a new pointer }
  305.             New( ThePointer );
  306.             { Move the data into it }
  307.             ThePointer^ :=
  308.              PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] )^;
  309.             { Add the item }
  310.             TheFTPSiteList.Add( ThePointer );
  311.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  312.              TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  313.           end;
  314.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  315.         end;
  316.     4 : begin { Do NNTP Site List }
  317.           { dispose the old FTP site list's pointers }
  318.           for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  319.           begin
  320.             Dispose( PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] ));
  321.           end;
  322.           { Clear the lists }
  323.           TheNewsServerList.Clear;
  324.           CCInetCCForm.ComboBox1.Clear;
  325.           { Add the new info }
  326.           for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
  327.           begin
  328.             { Create a new pointer }
  329.             New( ThePointer );
  330.             { Move the data into it }
  331.             ThePointer^ :=
  332.              PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] )^;
  333.             { Add the item }
  334.             TheNewsServerList.Add( ThePointer );
  335.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  336.              TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  337.           end;
  338.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  339.         end;
  340.     5 : begin { Do NNTP Newsgroups List }
  341.           { dispose the old NG list's pointers }
  342.           for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  343.           begin
  344.             Dispose( PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] ));
  345.           end;
  346.           { Clear the lists }
  347.           TheNewsRCList.Clear;
  348.           { Add the new info }
  349.           for Counter_1 := 0 to TheWorkingNRCSL.Count - 1 do
  350.           begin
  351.             { Create a new pointer }
  352.             New( TheNGRecord );
  353.             { Move the data into it }
  354.             TheNGRecord^ :=
  355.              PNewsGroupRecord( TheWorkingNRCSL.Items[ Counter_1 ] )^;
  356.             { Add the item }
  357.             TheNewsRCList.Add( TheNGRecord );
  358.           end;
  359.         end;
  360.     6 : begin { Do EMail Server List }
  361.           { dispose the old server list's pointers }
  362.           for Counter_1 := 0 to TheEMailServerList.Count - 1 do
  363.           begin
  364.             Dispose( PConnectionsRecord( TheEMailServerList.Items[ Counter_1 ] ));
  365.           end;
  366.           { Clear the lists }
  367.           TheEMailServerList.Clear;
  368.           CCInetCCForm.ComboBox1.Clear;
  369.           { Add the new info }
  370.           for Counter_1 := 0 to TheWorkingEMSL.Count - 1 do
  371.           begin
  372.             { Create a new pointer }
  373.             New( ThePointer );
  374.             { Move the data into it }
  375.             ThePointer^ :=
  376.              PConnectionsRecord( TheWorkingEMSL.Items[ Counter_1 ] )^;
  377.             { Add the item }
  378.             TheEMailServerList.Add( ThePointer );
  379.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  380.              TheEMailServerList.Items[ Counter_1 ] )^.CProfile );
  381.           end;
  382.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  383.         end;
  384.     7 : begin { Do Email mailboxes List }
  385.           { dispose the old NG list's pointers }
  386.           for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  387.           begin
  388.             Dispose( PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] ));
  389.           end;
  390.           { Clear the lists }
  391.           TheEMailMailboxList.Clear;
  392.           { Add the new info }
  393.           for Counter_1 := 0 to TheWorkingMBSL.Count - 1 do
  394.           begin
  395.             { Create a new pointer }
  396.             New( TheMBRecord );
  397.             { Move the data into it }
  398.             TheMBRecord^ :=
  399.              PEMailMailboxRecord( TheWorkingMBSL.Items[ Counter_1 ] )^;
  400.             { Add the item }
  401.             TheEMailMailboxList.Add( TheMBRecord );
  402.           end;
  403.         end;
  404.     8 : begin { Do EMail Correspondents List }
  405.           { dispose the old correspondents list's pointers }
  406.           for Counter_1 := 0 to TheCorrespondentsList.Count - 1 do
  407.           begin
  408.             Dispose( PConnectionsRecord( TheCorrespondentsList.Items[ Counter_1 ] ));
  409.           end;
  410.           { Clear the lists }
  411.           TheCorrespondentsList.Clear;
  412.           CCInetCCForm.ComboBox2.Clear;
  413.           CCInetCCForm.ComboBox3.Clear;
  414.           { Add the new info }
  415.           for Counter_1 := 0 to TheWorkingCPSL.Count - 1 do
  416.           begin
  417.             { Create a new pointer }
  418.             New( ThePointer );
  419.             { Move the data into it }
  420.             ThePointer^ :=
  421.              PConnectionsRecord( TheWorkingCPSL.Items[ Counter_1 ] )^;
  422.             { Add the item }
  423.             TheCorrespondentsList.Add( ThePointer );
  424.             CCINetCCForm.ComboBox2.Items.Add( PConnectionsRecord(
  425.              TheCorrespondentsList.Items[ Counter_1 ] )^.CProfile );
  426.             CCINetCCForm.ComboBox3.Items.Add( PConnectionsRecord(
  427.              TheCorrespondentsList.Items[ Counter_1 ] )^.CProfile );
  428.           end;
  429.           CCINetCCForm.ComboBox2.ItemIndex := 0;
  430.           CCINetCCForm.ComboBox3.ItemIndex := 0;
  431.         end;
  432.   end;
  433.   { Leave }
  434.   Close;
  435. end;
  436.  
  437. { This method cancels any changes made from entries in current setup & exits}
  438. procedure TCCICInfoDlg.BitBtn2Click(Sender: TObject);
  439. var Counter_1  : Integer;            { Loop counter        }
  440.     ThePointer : PConnectionsRecord; { Generic TCR Pointer }
  441.     TheNGRecord : PNewsGroupRecord;
  442.     TheEMMRecord : PEMailMailboxRecord;
  443. begin
  444.   { Use Tag vector do decide what to reset }
  445.   case Tag of
  446.     2 : begin { Reset FTP Site list }
  447.           { Dispose of all the old pointers }
  448.           for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
  449.           begin
  450.             Dispose( PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] ));
  451.           end;
  452.           { Clear the working list }
  453.           TheWorkingFTPSL.Clear;
  454.           { Clear the listbox }
  455.           ListBox2.Clear;
  456.           { Then rebuild the working list and display listbox }
  457.           for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  458.           begin
  459.             { Create the record }
  460.             New( ThePointer );
  461.             { Move data in }
  462.             ThePointer^ :=
  463.              PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] )^;
  464.             { Add the pointer to the list }
  465.             TheWorkingFTPSL.Add( ThePointer );
  466.             { Add the profile name to the list }
  467.             ListBox2.Items.Add( PConnectionsRecord(
  468.              TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  469.           end;
  470.         end;
  471.     4 : begin { Reset NNTP Site list }
  472.           { Dispose of all the old pointers }
  473.           for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
  474.           begin
  475.             Dispose( PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] ));
  476.           end;
  477.           { Clear the working list }
  478.           TheWorkingNSSL.Clear;
  479.           { Clear the listbox }
  480.           ListBox2.Clear;
  481.           { Then rebuild the working list and display listbox }
  482.           for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  483.           begin
  484.             { Create the record }
  485.             New( ThePointer );
  486.             { Move data in }
  487.             ThePointer^ :=
  488.              PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] )^;
  489.             { Add the pointer to the list }
  490.             TheWorkingNSSL.Add( ThePointer );
  491.             { Add the profile name to the list }
  492.             ListBox2.Items.Add( PConnectionsRecord(
  493.              TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  494.           end;
  495.         end;
  496.     5 : begin { Reset NNTP NG list }
  497.           { Dispose of all the old pointers }
  498.           for Counter_1 := 0 to TheWorkingNRCSL.Count - 1 do
  499.           begin
  500.             Dispose( PNewsGroupRecord( TheWorkingNRCSL.Items[ Counter_1 ] ));
  501.           end;
  502.           { Clear the working list }
  503.           TheWorkingNRCSL.Clear;
  504.           { Clear the listbox }
  505.           ListBox2.Clear;
  506.           { Then rebuild the working list and display listbox }
  507.           for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  508.           begin
  509.             { Create the record }
  510.             New( TheNGRecord );
  511.             { Move data in }
  512.             TheNGRecord^ :=
  513.              PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] )^;
  514.             { Add the pointer to the list }
  515.             TheWorkingNRCSL.Add( TheNGRecord );
  516.             { Add the profile name to the list }
  517.             ListBox2.Items.Add( PNewsGroupRecord(
  518.              TheNewsRCList.Items[ Counter_1 ] )^.GName );
  519.           end;
  520.         end;
  521.     6 : begin { Reset FTP Site list }
  522.           { Dispose of all the old pointers }
  523.           for Counter_1 := 0 to TheWorkingEMSL.Count - 1 do
  524.           begin
  525.             Dispose( PConnectionsRecord( TheWorkingEMSL.Items[ Counter_1 ] ));
  526.           end;
  527.           { Clear the working list }
  528.           TheWorkingEMSL.Clear;
  529.           { Clear the listbox }
  530.           ListBox2.Clear;
  531.           { Then rebuild the working list and display listbox }
  532.           for Counter_1 := 0 to TheEMailServerList.Count - 1 do
  533.           begin
  534.             { Create the record }
  535.             New( ThePointer );
  536.             { Move data in }
  537.             ThePointer^ :=
  538.              PConnectionsRecord( TheEMailServerList.Items[ Counter_1 ] )^;
  539.             { Add the pointer to the list }
  540.             TheWorkingEMSL.Add( ThePointer );
  541.             { Add the profile name to the list }
  542.             ListBox2.Items.Add( PConnectionsRecord(
  543.              TheEMailServerList.Items[ Counter_1 ] )^.CProfile );
  544.           end;
  545.         end;
  546.     7 : begin { Reset NNTP NG list }
  547.           { Dispose of all the old pointers }
  548.           for Counter_1 := 0 to TheWorkingMBSL.Count - 1 do
  549.           begin
  550.             Dispose( PEMailMailboxRecord( TheWorkingMBSL.Items[ Counter_1 ] ));
  551.           end;
  552.           { Clear the working list }
  553.           TheWorkingMBSL.Clear;
  554.           { Clear the listbox }
  555.           ListBox2.Clear;
  556.           { Then rebuild the working list and display listbox }
  557.           for Counter_1 := 0 to TheEMailMailboxList.Count - 1 do
  558.           begin
  559.             { Create the record }
  560.             New( TheEMMRecord );
  561.             { Move data in }
  562.             TheEMMRecord^ :=
  563.              PEMailMailboxRecord( TheEMailMailboxList.Items[ Counter_1 ] )^;
  564.             { Add the pointer to the list }
  565.             TheWorkingMBSL.Add( TheEMMRecord );
  566.             { Add the profile name to the list }
  567.             ListBox2.Items.Add( PEMailMailboxRecord(
  568.              TheEMailMailboxList.Items[ Counter_1 ] )^.MBName );
  569.           end;
  570.         end;
  571.     8 : begin { Reset FTP Site list }
  572.           { Dispose of all the old pointers }
  573.           for Counter_1 := 0 to TheWorkingCPSL.Count - 1 do
  574.           begin
  575.             Dispose( PConnectionsRecord( TheWorkingCPSL.Items[ Counter_1 ] ));
  576.           end;
  577.           { Clear the working list }
  578.           TheWorkingCPSL.Clear;
  579.           { Clear the listbox }
  580.           ListBox2.Clear;
  581.           { Then rebuild the working list and display listbox }
  582.           for Counter_1 := 0 to TheCorrespondentsList.Count - 1 do
  583.           begin
  584.             { Create the record }
  585.             New( ThePointer );
  586.             { Move data in }
  587.             ThePointer^ :=
  588.              PConnectionsRecord( TheCorrespondentsList.Items[ Counter_1 ] )^;
  589.             { Add the pointer to the list }
  590.             TheWorkingCPSL.Add( ThePointer );
  591.             { Add the profile name to the list }
  592.             ListBox2.Items.Add( PConnectionsRecord(
  593.              TheCorrespondentsList.Items[ Counter_1 ] )^.CProfile );
  594.           end;
  595.         end;
  596.   end;
  597.   { Leave }
  598.   Close;
  599. end;
  600.  
  601. procedure TCCICInfoDlg.Edit4Exit(Sender: TObject);
  602. begin
  603.   { Use tag vector to determine action }
  604.   case Tag of
  605.     2 : begin
  606.           { If Edit4 is modified then mangle pw }
  607.           if Edit4.Modified then
  608.           begin
  609.             { Save pw in either case, but mangle if masked }
  610.             case PasswordControlVector of
  611.               1 : CurrentRealPWString := Edit4.Text;
  612.               2 : begin
  613.                     CurrentRealPWString := Edit4.Text;
  614.                     Edit4.Text := '***********';
  615.                   end;
  616.             end;
  617.           end;
  618.         end;
  619.     6 : begin
  620.           { If Edit4 is modified then mangle pw }
  621.           if Edit4.Modified then
  622.           begin
  623.             { Save pw in either case, but mangle if masked }
  624.             case EMPasswordControlVector of
  625.               1 : CurrentEMRealPWString := Edit4.Text;
  626.               2 : begin
  627.                     CurrentEMRealPWString := Edit4.Text;
  628.                     Edit4.Text := '***********';
  629.                   end;
  630.             end;
  631.           end;
  632.         end;
  633.   end;
  634. end;
  635.  
  636. { Add button; do various add actions }
  637. procedure TCCICInfoDlg.Button2Click(Sender: TObject);
  638. var ThePointer  : PConnectionsRecord; { PCR Pointer }
  639.     TheNGRecord : PNewsGroupRecord;
  640.     TheEMBRecord : PEMailMailboxRecord;
  641.     TempList    : TList;
  642. begin
  643.   { Tag vector control as usual }
  644.   case Tag of
  645.     2 : begin { add new FTP site list entry }
  646.           { Creat new PCR pointer }
  647.           New( ThePointer );
  648.           { Add in the data from the text fields }
  649.           with ThePointer^ do
  650.           begin
  651.             CProfile   := Edit1.Text;
  652.             CIPAddress := Edit2.Text;;
  653.             CUserName  := Edit3.Text;
  654.             { Put in the real pw string }
  655.             CPassword  := CurrentRealPWString;
  656.             CStartDir  := Edit5.Text;
  657.           end;
  658.           { Add pointer to working list }
  659.           TheWorkingFTPSL.Add( ThePointer );
  660.           { Add it to the listbox }
  661.           ListBox2.Items.Add( ThePointer^.CProfile );
  662.           { And set the pointer to it }
  663.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  664.         end;
  665.     4 : begin { add new NNTP site list entry }
  666.           { Creat new PCR pointer }
  667.           New( ThePointer );
  668.           { Add in the data from the text fields }
  669.           with ThePointer^ do
  670.           begin
  671.             CProfile   := Edit1.Text;
  672.             CIPAddress := Edit2.Text;;
  673.             CUserName  := '';
  674.             CPassword  := '';
  675.             CStartDir  := '';
  676.           end;
  677.           { Add pointer to working list }
  678.           TheWorkingNSSL.Add( ThePointer );
  679.           { Add it to the listbox }
  680.           ListBox2.Items.Add( ThePointer^.CProfile );
  681.           { And set the pointer to it }
  682.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  683.         end;
  684.     5 : begin { add new NNTP newsgroup list entry }
  685.           { Creat new PCR pointer }
  686.           New( TheNGRecord );
  687.           TempList := TList.Create;
  688.           { Add in the data from the text fields }
  689.           with TheNGRecord^ do
  690.           begin
  691.             GName     := Edit1.Text;
  692.             GRealName := Edit2.Text;;
  693.             if Edit3.Text = 'UnSubscribed' then GSubscribed := false else
  694.              GSubScribed := true;
  695.             GLowest              := 0;
  696.             GHighest             := 0;
  697.             GTotalNew            := 0;
  698.             GTotalAvailable      := 0;
  699.             GLowestAvailable     := 0;
  700.             GHighestAvailable    := 0;
  701.             GPostable            := true;
  702.             GTotalArticles       := 0;
  703.             GTotalUnReadArticles := 0;
  704.             GIDNumber            := TheWorkingNRCSL.Count + 1;
  705.             GFileName            := 'NL' + IntToStr( WhichServer ) + 'G' +
  706.                                     IntToStr( GIDNumber) + '.NGR';
  707.             GLTag                := Longint( TempList );
  708.           end;
  709.           { Add pointer to working list }
  710.           TheWorkingNRCSL.Add( TheNGRecord );
  711.           { Add it to the listbox }
  712.           ListBox2.Items.Add( TheNGRecord^.GName );
  713.           { And set the pointer to it }
  714.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  715.         end;
  716.     6 : begin { add new EMail server list entry }
  717.           { Creat new PCR pointer }
  718.           New( ThePointer );
  719.           { Add in the data from the text fields }
  720.           with ThePointer^ do
  721.           begin
  722.             CProfile   := Edit1.Text;
  723.             CIPAddress := Edit2.Text;;
  724.             CUserName  := Edit3.Text;
  725.             { Put in the real pw string }
  726.             CPassword  := CurrentEMRealPWString;
  727.             CStartDir  := Edit5.Text;
  728.           end;
  729.           { Add pointer to working list }
  730.           TheWorkingEMSL.Add( ThePointer );
  731.           { Add it to the listbox }
  732.           ListBox2.Items.Add( ThePointer^.CProfile );
  733.           { And set the pointer to it }
  734.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  735.         end;
  736.     7 : begin { add new mailbox list entry }
  737.           { Creat new PCR pointer }
  738.           New( TheEMBRecord );
  739.           TempList := TList.Create;
  740.           { Add in the data from the text fields }
  741.           with TheEMBRecord^ do
  742.           begin
  743.             MBName        := Edit1.Text;
  744.             MBIDNumber    := TheWorkingMBSL.Count + 1;
  745.             MBMaxMsgNumber := 0;
  746.             MBTotal       := 0;
  747.             MBUnReadTotal := 0;
  748.             MBUnSentTotal := 0;
  749.             MBMsgFileName := 'MB' + IntToStr( MBIDNumber ) + '.MBX';
  750.             MBLTag        := Longint( TempList );
  751.           end;
  752.           { Add pointer to working list }
  753.           TheWorkingMBSL.Add( TheEMBRecord );
  754.           { Add it to the listbox }
  755.           ListBox2.Items.Add( TheEMBRecord^.MBName );
  756.           { And set the pointer to it }
  757.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  758.           ListBox2Click( Self );
  759.         end;
  760.     8 : begin { add new correspondents list entry }
  761.           { Creat new PCR pointer }
  762.           New( ThePointer );
  763.           { Add in the data from the text fields }
  764.           with ThePointer^ do
  765.           begin
  766.             CProfile   := Edit1.Text;
  767.             CIPAddress := Edit2.Text;
  768.           end;
  769.           { Add pointer to working list }
  770.           TheWorkingCPSL.Add( ThePointer );
  771.           { Add it to the listbox }
  772.           ListBox2.Items.Add( ThePointer^.CProfile );
  773.           { And set the pointer to it }
  774.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  775.         end;
  776.   end;
  777. end;
  778.  
  779. { This is the modify button }
  780. procedure TCCICInfoDlg.Button3Click(Sender: TObject);
  781. begin
  782.   { Use Tag vector as usual }
  783.   case Tag of
  784.     2 : begin
  785.           { if nothing to modify the exit }
  786.           if ListBox2.ItemIndex = -1 then exit;
  787.           { get record of current listbox pointer & put in data }
  788.           with PConnectionsRecord(
  789.            TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  790.           begin
  791.             CProfile   := Edit1.Text;
  792.             CIPAddress := Edit2.Text;;
  793.             CUserName  := Edit3.Text;
  794.             { Put in the real pw string }
  795.             CPassword  := CurrentRealPWString;
  796.             CStartDir  := Edit5.Text;
  797.           end;
  798.           { Make sure the display matches the edit control }
  799.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  800.         end;
  801.     4 : begin
  802.           { if nothing to modify the exit }
  803.           if ListBox2.ItemIndex = -1 then exit;
  804.           { get record of current listbox pointer & put in data }
  805.           with PConnectionsRecord(
  806.            TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  807.           begin
  808.             CProfile   := Edit1.Text;
  809.             CIPAddress := Edit2.Text;
  810.             CUserName  := '';
  811.             CPassword  := '';
  812.             CStartDir  := '';
  813.           end;
  814.           { Make sure the display matches the edit control }
  815.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  816.         end;
  817.     5 : begin
  818.           { if nothing to modify the exit }
  819.           if ListBox2.ItemIndex = -1 then exit;
  820.           { get record of current listbox pointer & put in data }
  821.           with PNewsGroupRecord(
  822.            TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  823.           begin
  824.             GName     := Edit1.Text;
  825.             GRealName := Edit2.Text;;
  826.             if Edit3.Text = 'UnSubscribed' then GSubscribed := false else
  827.              GSubScribed := true;
  828.           end;
  829.           { Make sure the display matches the edit control }
  830.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  831.         end;
  832.     6 : begin
  833.           { if nothing to modify the exit }
  834.           if ListBox2.ItemIndex = -1 then exit;
  835.           { get record of current listbox pointer & put in data }
  836.           with PConnectionsRecord(
  837.            TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  838.           begin
  839.             CProfile   := Edit1.Text;
  840.             CIPAddress := Edit2.Text;;
  841.             CUserName  := Edit3.Text;
  842.             { Put in the real pw string }
  843.             CPassword  := CurrentEMRealPWString;
  844.             CStartDir  := Edit5.Text;
  845.           end;
  846.           { Make sure the display matches the edit control }
  847.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  848.         end;
  849.     7 : begin
  850.           { if nothing to modify the exit }
  851.           if ListBox2.ItemIndex = -1 then exit;
  852.           { get record of current listbox pointer & put in data }
  853.           with PEMailMailboxRecord(
  854.            TheWorkingMBSL.Items[ ListBox2.ItemIndex ] )^ do
  855.           begin
  856.             MBName     := Edit1.Text;
  857.           end;
  858.           { Make sure the display matches the edit control }
  859.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  860.           ListBox2Click( Self );
  861.         end;
  862.     8 : begin
  863.           { if nothing to modify the exit }
  864.           if ListBox2.ItemIndex = -1 then exit;
  865.           { get record of current listbox pointer & put in data }
  866.           with PConnectionsRecord(
  867.            TheWorkingCPSL.Items[ ListBox2.ItemIndex ] )^ do
  868.           begin
  869.             CProfile   := Edit1.Text;
  870.             CIPAddress := Edit2.Text;;
  871.           end;
  872.           { Make sure the display matches the edit control }
  873.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  874.         end;
  875.   end;
  876. end;
  877.  
  878. { This is the delete button }
  879. procedure TCCICInfoDlg.Button4Click(Sender: TObject);
  880. var MessageString : String; { String holder }
  881. begin
  882.   { Use tag control vector }
  883.   case Tag of
  884.     2 : begin
  885.           { If nothing to delete then leave }
  886.           if Listbox2.Itemindex = -1 then exit;
  887.           { Set up display }
  888.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  889.           { Display message box and get result }
  890.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  891.            = mrYes then
  892.           begin
  893.             { if ok delete then remove item from working sl }
  894.             TheWorkingFTPSL.Delete( ListBox2.ItemIndex );
  895.             { delete from listbox }
  896.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  897.             { If nothing left set itemindex and clear edits }
  898.             if ListBox2.Items.Count = 0 then
  899.             begin
  900.               ListBox2.ItemIndex := -1;
  901.               Edit1.Text := '';
  902.               Edit2.Text := '';
  903.               Edit3.Text := '';
  904.               Edit4.Text := '';
  905.               Edit5.Text := '';
  906.             end
  907.             else
  908.             begin
  909.               { Reset listbox pointer }
  910.               ListBox2.ItemIndex  := 0;
  911.               { and reset display to new item }
  912.               with PConnectionsRecord(
  913.                TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  914.               begin
  915.                 Edit1.Text := CProfile;
  916.                 Edit2.Text := CIPAddress;
  917.                 Edit3.Text := CUserName;
  918.                 CurrentRealPWString := CPassword;
  919.                 case PasswordControlVector of
  920.                   1 : Edit4.Text := CPassword;
  921.                   2 : Edit4.Text := '**********';
  922.                 end;
  923.                 Edit5.Text := CStartDir;
  924.               end;
  925.             end;
  926.           end;
  927.         end;
  928.     4 : begin
  929.           { If nothing to delete then leave }
  930.           if Listbox2.Itemindex = -1 then exit;
  931.           { Set up display }
  932.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  933.           { Display message box and get result }
  934.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  935.            = mrYes then
  936.           begin
  937.             { if ok delete then remove item from working sl }
  938.             TheWorkingNSSL.Delete( ListBox2.ItemIndex );
  939.             { delete from listbox }
  940.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  941.             { If nothing left set itemindex and clear edits }
  942.             if ListBox2.Items.Count = 0 then
  943.             begin
  944.               ListBox2.ItemIndex := -1;
  945.               Edit1.Text := '';
  946.               Edit2.Text := '';
  947.               Edit3.Text := '';
  948.               Edit4.Text := '';
  949.               Edit5.Text := '';
  950.             end
  951.             else
  952.             begin
  953.               { Reset listbox pointer }
  954.               ListBox2.ItemIndex  := 0;
  955.               { and reset display to new item }
  956.               with PConnectionsRecord(
  957.                TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  958.               begin
  959.                 Edit1.Text := CProfile;
  960.                 Edit2.Text := CIPAddress;
  961.               end;
  962.             end;
  963.           end;
  964.         end;
  965.     5 : begin
  966.           { If nothing to delete then leave }
  967.           if Listbox2.Itemindex = -1 then exit;
  968.           { Set up display }
  969.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  970.           { Display message box and get result }
  971.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  972.            = mrYes then
  973.           begin
  974.             { if ok delete then remove item from working sl }
  975.             TheWorkingNRCSL.Delete( ListBox2.ItemIndex );
  976.             { delete from listbox }
  977.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  978.             { If nothing left set itemindex and clear edits }
  979.             if ListBox2.Items.Count = 0 then
  980.             begin
  981.               ListBox2.ItemIndex := -1;
  982.               Edit1.Text := '';
  983.               Edit2.Text := '';
  984.               Edit3.Text := '';
  985.               Edit4.Text := '';
  986.               Edit5.Text := '';
  987.             end
  988.             else
  989.             begin
  990.               { Reset listbox pointer }
  991.               ListBox2.ItemIndex  := 0;
  992.               { and reset display to new item }
  993.               with PNewsGroupRecord(
  994.                TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  995.               begin
  996.                 Edit1.Text := GName;
  997.                 Edit2.Text := GRealName;
  998.                 if not GSubscribed then Edit3.Text := 'UnSubscribed' else
  999.                  Edit3.Text := 'SubScribed';
  1000.               end;
  1001.             end;
  1002.           end;
  1003.         end;
  1004.     6 : begin
  1005.           { If nothing to delete then leave }
  1006.           if Listbox2.Itemindex = -1 then exit;
  1007.           { Set up display }
  1008.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  1009.           { Display message box and get result }
  1010.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  1011.            = mrYes then
  1012.           begin
  1013.             { if ok delete then remove item from working sl }
  1014.             TheWorkingEMSL.Delete( ListBox2.ItemIndex );
  1015.             { delete from listbox }
  1016.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  1017.             { If nothing left set itemindex and clear edits }
  1018.             if ListBox2.Items.Count = 0 then
  1019.             begin
  1020.               ListBox2.ItemIndex := -1;
  1021.               Edit1.Text := '';
  1022.               Edit2.Text := '';
  1023.               Edit3.Text := '';
  1024.               Edit4.Text := '';
  1025.               Edit5.Text := '';
  1026.             end
  1027.             else
  1028.             begin
  1029.               { Reset listbox pointer }
  1030.               ListBox2.ItemIndex  := 0;
  1031.               { and reset display to new item }
  1032.               with PConnectionsRecord(
  1033.                TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  1034.               begin
  1035.                 Edit1.Text := CProfile;
  1036.                 Edit2.Text := CIPAddress;
  1037.                 Edit3.Text := CUserName;
  1038.                 CurrentEMRealPWString := CPassword;
  1039.                 case EMPasswordControlVector of
  1040.                   1 : Edit4.Text := CPassword;
  1041.                   2 : Edit4.Text := '**********';
  1042.                 end;
  1043.                 Edit5.Text := CStartDir;
  1044.               end;
  1045.             end;
  1046.           end;
  1047.         end;
  1048.     7 : begin
  1049.           { If nothing to delete then leave }
  1050.           if Listbox2.Itemindex = -1 then exit;
  1051.           { Set up display }
  1052.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  1053.           { Display message box and get result }
  1054.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  1055.            = mrYes then
  1056.           begin
  1057.             { if ok delete then remove item from working sl }
  1058.             TheWorkingMBSL.Delete( ListBox2.ItemIndex );
  1059.             { delete from listbox }
  1060.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  1061.             { If nothing left set itemindex and clear edits }
  1062.             if ListBox2.Items.Count = 0 then
  1063.             begin
  1064.               ListBox2.ItemIndex := -1;
  1065.               Edit1.Text := '';
  1066.               Edit2.Text := '';
  1067.               Edit3.Text := '';
  1068.               Edit4.Text := '';
  1069.               Edit5.Text := '';
  1070.             end
  1071.             else
  1072.             begin
  1073.               { Reset listbox pointer }
  1074.               ListBox2.ItemIndex  := 0;
  1075.               { and reset display to new item }
  1076.               with PEmailmailboxRecord(
  1077.                TheWorkingMBSL.Items[ ListBox2.ItemIndex ] )^ do
  1078.               begin
  1079.                 Edit1.Text := MBName;
  1080.               end;
  1081.             end;
  1082.           end;
  1083.         end;
  1084.     8 : begin
  1085.           { If nothing to delete then leave }
  1086.           if Listbox2.Itemindex = -1 then exit;
  1087.           { Set up display }
  1088.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  1089.           { Display message box and get result }
  1090.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  1091.            = mrYes then
  1092.           begin
  1093.             { if ok delete then remove item from working sl }
  1094.             TheWorkingCPSL.Delete( ListBox2.ItemIndex );
  1095.             { delete from listbox }
  1096.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  1097.             { If nothing left set itemindex and clear edits }
  1098.             if ListBox2.Items.Count = 0 then
  1099.             begin
  1100.               ListBox2.ItemIndex := -1;
  1101.               Edit1.Text := '';
  1102.               Edit2.Text := '';
  1103.               Edit3.Text := '';
  1104.               Edit4.Text := '';
  1105.               Edit5.Text := '';
  1106.             end
  1107.             else
  1108.             begin
  1109.               { Reset listbox pointer }
  1110.               ListBox2.ItemIndex  := 0;
  1111.               { and reset display to new item }
  1112.               with PConnectionsRecord(
  1113.                TheWorkingCPSL.Items[ ListBox2.ItemIndex ] )^ do
  1114.               begin
  1115.                 Edit1.Text := CProfile;
  1116.                 Edit2.Text := CIPAddress;
  1117.               end;
  1118.             end;
  1119.           end;
  1120.         end;
  1121.   end;
  1122. end;
  1123.  
  1124. procedure TCCICInfoDlg.ListBox1DblClick(Sender: TObject);
  1125. begin
  1126.   case Tag of
  1127.     5 : begin
  1128.           if ListBox1.ItemIndex <> -1 then
  1129.            Edit2.Text := ListBox1.Items[ Listbox1.ItemIndex ];
  1130.         end;
  1131.   end;
  1132. end;
  1133.  
  1134. end.
  1135.